package controller

import (
	"gitee.com/ai-love-save/ai-love-save-back/internal/model"
	"gitee.com/ai-love-save/ai-love-save-back/pkg/warpper"
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
)

// MenuSet
var MenuSet = wire.NewSet(wire.Struct(new(Menu), "*"))

// Menu
type Menu struct {
	MenuModel *model.MenuModel
}

func (m *Menu) GetMenu(c *gin.Context) {
	ctx := c.Request.Context()

	userAuth := warpper.GetUserAuthority(c)
	res, err := m.MenuModel.QueryMenu(ctx, userAuth)
	if err != nil {
		warpper.ResError(c, err)
		return
	}

	warpper.ResSuccess(c, res)
}
